// adapter/base-adapter.js
export class BaseAdapter {
  constructor() {
    this.platform = 'unknown'
    this.supportedMethods = []
  }

  // 检查环境是否匹配
  isMatch() {
    throw new Error('isMatch method must be implemented')
  }

  // 初始化适配器
  async init() {
    // 默认实现，子类可重写
  }

  // 调用原生方法
  async invoke(method, params = {}) {
    console.log("🚀 ~ base-adapter.js:20 ~ BaseAdapter ~ invoke ~ params:", params,method)
    throw new Error('invoke method must be implemented')
  }

  // 注册事件监听
  on(event, callback) {
    console.log("🚀 ~ base-adapter.js:26 ~ BaseAdapter ~ on ~ event:", event,callback)
    throw new Error('on method must be implemented')
  }

  // 获取设备信息
  async getDeviceInfo() {
    throw new Error('getDeviceInfo method must be implemented')
  }

  // 获取用户信息
  async getUserInfo() {
    throw new Error('getUserInfo method must be implemented')
  }
}